package com.yueyang.sojourn.server.service.sojourn.projectshare;

import com.yueyang.sojourn.server.model.po.SojournProjectShare;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 项目分账
 * @author Andy.yang
 * @version v1
 * @summary
 * @Copyright (c) 2019, YueYang Group All Rights Reserved.
 * @since 2020/3/22
 */
@Mapper
public interface SojournProjectShareMapper {
    /**
     * 批量插入
     * @param shares
     * @return
     */
    int batchInsert(@Param("list") List<SojournProjectShare> shares);

    /**
     * 批量更新
     * @param shares
     * @return
     */
    int batchUpdate(@Param("list") List<SojournProjectShare> shares);

    /**
     * 批量删除
     * @param shareIds
     * @return
     */
    int batchDel(@Param("list") List<Long> shareIds,@Param("updator") Long updator);

    /**
     * 创建项目分账
     * @param projectShare
     * @return
     */
    int insert(SojournProjectShare projectShare);

    /**
     * 删除
     * @param id
     * @return
     */
    int delete(@Param("id") Long id, @Param("updator") Long updator);

    /**
     * 修改项目分账状态
     * @param projectShare
     * @return
     */
    int update(SojournProjectShare projectShare);

    /**
     * 更新同步状态
     * @param id
     * @param synStatus
     * @return
     */
    int updateThirdSynStatus(@Param("id") Long id,@Param("thirdSynStatus") int synStatus);

    /**
     * 查询项目分账
     * @param id
     * @return
     */
    SojournProjectShare selectByPrimaryKey(Long id);

    /**
     *  查询项目分账列表
     * @param status
     * @return
     */
    List<SojournProjectShare> findBy(@Param("projectId") Long projectId,
                                     @Param("status") Integer status,
                                     @Param("thirdSynStatus") Integer thirdSynStatus);

    /**
     * 根据项目查询
     * @param projectId
     * @return
     */
    List<SojournProjectShare> findByProjectId(@Param("projectId") Long projectId);
}
